package com.example.ResumeWorkPlatform.dao;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * @ClassName: BoardEntity
 * @Description: 考勤实体类
 * @Author chengwenixng
 * @DateTime 2020-3-31 19:59:45
 */
//管理员实体继承自Serializable创建的对象可以被JVM（java虚拟机）序列化（序列化就是有一个自己独特的标识）

@Entity
@Table(name = "board_entity")
public class BoardEntity implements Serializable{

	//序列化
	private static final long serialVersionUID = 1L;
	/**
	 * 数据库自增长ID
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;
	
	
	/**
	 * 删除标识符
	 */
	private boolean delFlag = true;
	
	/**
	 * 考勤时间
	 */
	private Date ceckingInTime = new Date();
	/**
	 * 工业园区-考勤（一对一）
	 */
	@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	private GerdenEntity gerdenEntity;
	/**
	 * 考勤-用户 多对一
	 */
	@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY)
	private BasicUserEntity basicUserEntity;
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public boolean isDelFlag() {
		return delFlag;
	}
	public void setDelFlag(boolean delFlag) {
		this.delFlag = delFlag;
	}
	public Date getCeckingInTime() {
		return ceckingInTime;
	}
	public void setCeckingInTime(Date ceckingInTime) {
		this.ceckingInTime = ceckingInTime;
	}
	public GerdenEntity getGerdenEntity() {
		return gerdenEntity;
	}
	public void setGerdenEntity(GerdenEntity gerdenEntity) {
		this.gerdenEntity = gerdenEntity;
	}
	public BasicUserEntity getBasicUserEntity() {
		return basicUserEntity;
	}
	public void setBasicUserEntity(BasicUserEntity basicUserEntity) {
		this.basicUserEntity = basicUserEntity;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((basicUserEntity == null) ? 0 : basicUserEntity.hashCode());
		result = prime * result + ((ceckingInTime == null) ? 0 : ceckingInTime.hashCode());
		result = prime * result + (delFlag ? 1231 : 1237);
		result = prime * result + ((gerdenEntity == null) ? 0 : gerdenEntity.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		BoardEntity other = (BoardEntity) obj;
		if (basicUserEntity == null) {
			if (other.basicUserEntity != null)
				return false;
		} else if (!basicUserEntity.equals(other.basicUserEntity))
			return false;
		if (ceckingInTime == null) {
			if (other.ceckingInTime != null)
				return false;
		} else if (!ceckingInTime.equals(other.ceckingInTime))
			return false;
		if (delFlag != other.delFlag)
			return false;
		if (gerdenEntity == null) {
			if (other.gerdenEntity != null)
				return false;
		} else if (!gerdenEntity.equals(other.gerdenEntity))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}
	
	
}
